

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;

import javax.swing.JOptionPane;

public class RouterThread implements Runnable {
	private Socket server;
	private String line, input;
	Router r;

	RouterThread(Socket server, Router r) {
		this.r = r;
		this.server = server;
	}


	public void run() {

		input = "";

		try {
			// Get input from the client
		
			long startTime = System.nanoTime();
			DataInputStream in = new DataInputStream(server.getInputStream());
			r.Ing_data.setText(in.readUTF());
			// Now write to the client
			DataOutputStream d = new DataOutputStream(server.getOutputStream());
			long endTime = System.nanoTime() - startTime;
			d.writeLong(endTime);
			//server.close();
		
			
		} catch (IOException ioe) {
			System.out.println("IOException on socket listen: " + ioe);
			ioe.printStackTrace();
		}
	}
}
